package com.controller;

import com.mapper.ItemMapper;
import com.mapper.UserMapper;
import com.model.Item;
import com.service.ItemService;
import com.vo.ItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/item")
public class ItemRestController {
    @Autowired
    private ItemService itemService;

    @RequestMapping("/list")
    public List<Item> getAllItem(){
        return itemService.getItemList();
    }

    /**
     * @param id
     * */
    @RequestMapping("/")
    public Item getItemById(Long id){
        return itemService.getItemById(id);
    }

    /**
     * @param itemname
     * */
    @RequestMapping("/search")
    public List<Item> getItemByName(String itemname){
        return itemService.getItemByName(itemname);
    }
}
